package com.jxcq.tensquare.friend.config;

import com.jxcq.tensquare.friend.interceptor.JWTInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author CalvinXCui
 * @date 2019- 10- 17 17:11
 */
@Component
public class InterceptorConfig extends WebMvcConfigurationSupport {

    @Autowired
    private JWTInterceptor jwtInterceptor;

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor)
                .addPathPatterns("/**")//要拦截的路径
                .excludePathPatterns("/**/login/**");//不拦截的路径
    }
}
